home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
JCSM Shareware Collection 1993 November
/
JCSM Shareware Collection - 1993-11.iso
/
cl720
/
sst115j.lzh
/
SSTWIN.H
< prev
next >
Wrap
C/C++ Source or Header
|
1992-07-17
|
13KB
|
262 lines
/* ------------------------------------------------------------------------ */
/* sstwin.h */
/* */
/* windows header file */
/* */
/* CopyRight (C) 1991,1992 Steven Lutrov. All rights reserved. */
/* ------------------------------------------------------------------------ */
#ifdef TRUE
#undef TRUE
#endif
#ifdef FALSE
#undef FALSE
#endif
#ifdef ERROR
#undef ERROR
#endif
#ifdef OK
#undef OK
#endif
#define TRUE 1
#define FALSE 0
#define ERROR -1
#define OK 0
#define ON 1
#define OFF 0
/* ------------------------------------------------------------------------ */
/* input field controller structures */
/* ------------------------------------------------------------------------ */
typedef struct field { /* data entry field description */
char *fmask; /* field data entry mask */
int fprot; /* field protection */
char *fbuff; /* field buffer */
int ftype; /* field type */
int fflags; /* field flags */
int frow; /* field row */
int fcol; /* field column */
void (*fhelp)(char *); /* field help function */
char *fhwin; /* field help window */
int flx, fly; /* help window location */
int helptype; /* class of help */
int (*fvalid)(char *); /* field post validation func */
void (*fprevalid)(int *); /* field pre validation func */
void (*ferror)(char *); /* field error function */
struct field *fnxt; /* next field on template */
struct field *fprv; /* previous field on template */
} FIELD;
/* ------------------------------------------------------------------------ */
/* window controller structures */
/* ------------------------------------------------------------------------ */
typedef struct _wnd {
char *_ws; /* points to window save block */
char *_title; /* points to window title */
char *_footer; /* points to window footer title */
int _tjust :8; /* title justification */
int _fjust :8; /* footer justification */
int _wx :8; /* nw x coordinate */
int _wy :6; /* nw y coordinate */
int _wv :1; /* true if window is visible */
int _hd :1; /* true if window was hidden */
int _ww :8; /* window width */
int _wh :8; /* window height */
int _wsp :8; /* scroll pointer */
int _sp :8; /* selection pointer */
int _cr :8; /* cursor x location */
int btype; /* border type */
unsigned char wcolour[6]; /* colours for window */
unsigned char _pn; /* previous normal colour */
struct _wnd *_nx; /* points to next window */
struct _wnd *_pv; /* points to previous window */
FIELD *_fh; /* points to 1st data entry fld */
FIELD *_ft; /* points to last data entry fld */
} WINDOW;
/* ------------------------------------------------------------------------ */
/* window attribute components */
/* ------------------------------------------------------------------------ */
#define WIN_BORDER 0x000 /* border or frame */
#define WIN_TITLE 0x001 /* title area */
#define WIN_ACCENT 0x002 /* accent or highlight bar */
#define WIN_FACE 0x003 /* window face */
#define WIN_FLDFACE 0x004 /* window field face */
#define WIN_FOOT 0x005 /* window footer */
#define WIN_ALL 0x006 /* all above components */
#define BRIGHT 0x008 /* high intensity */
#define DIM 0x000 /* low intensity */
/* ------------------------------------------------------------------------ */
/* window border components */
/* ------------------------------------------------------------------------ */
#define BRD_SPACE 0x000 /* single line */
#define BRD_SINGLE 0x001 /* single line */
#define BRD_DOUBLE 0x002 /* double line */
#define BRD_DOUBLESIDE 0x003 /* double sides & single top */
#define BRD_DOUBLETOP 0x004 /* double top & single sides */
#define BRD_SINGLESIDE BRD_DOUBLETOP /* ditto */
#define BRD_SINGLETOP BRD_DOUBLESIDE /* ditto */
#define BRD_PULLDOWN 0x005 /* used in pulldown menus */
#define BRD_NOBORDER 0x009 /* no border */
/* ------------------------------------------------------------------------ */
/* justification components */
/* ------------------------------------------------------------------------ */
#define JUST_C 0x001 /* centre justify */
#define JUST_L 0x002 /* left justify */
#define JUST_R 0x004 /* right justify */
/* ------------------------------------------------------------------------ */
/* field components */
/* ------------------------------------------------------------------------ */
#define FIELDCHAR 0x05F /* "_" char for field masks */
#define FLD_ALNUM 0x001 /* alpha & numeric */
#define FLD_ALPHA 0x002 /* alpha only */
#define FLD_DIGIT 0x004 /* digit only */
#define FLD_ASCII 0x008 /* ascii char only */
#define FLD_PRINT 0x010 /* printable character */
#define FLD_XDIGIT 0x020 /* hexadecimal char */
#define FLD_DATE 0x040 /* date fromat char */
#define FLD_INT 0x080 /* integer */
#define FLD_CURR 0x100 /* currency format */
/* ------------------------------------------------------------------------ */
/* field flag components */
/* ------------------------------------------------------------------------ */
#define FLD_LJUST 0x001 /* left justify field */
#define FLD_RJUST 0x002 /* right justify field */
#define FLD_TOUPPER 0x004 /* convert field to upper case */
#define FLD_TOLOWER 0x008 /* convert field to lower case */
#define FLD_TOPROPER 0x010 /* convert field to Proper case */
#define FLD_ZFILL 0x020 /* fill blanks with zero char */
/* ------------------------------------------------------------------------ */
/* help system components */
/* ------------------------------------------------------------------------ */
#define HELP_KEYED 0x001 /* field help when help key pressed */
#define HELP_INITIAL 0x002 /* field help when initialy on field */
#define HELP_ALWAYS 0x002 /* field help when always on field */
#define HELP_DONE 0x010 /* help completed */
/* ------------------------------------------------------------------------ */
/* quick access macros */
/* ------------------------------------------------------------------------ */
#define SAV (wnd->_ws)
#define WTITLE (wnd->_title)
#define WFOOT (wnd->_footer)
#define TJUST (wnd->_tjust)
#define FJUST (wnd->_fjust)
#define COL (wnd->_wx)
#define ROW (wnd->_wy)
#define WIDTH (wnd->_ww)
#define HEIGHT (wnd->_wh)
#define SCROLL (wnd->_wsp)
#define SELECT (wnd->_sp)
#define WCURS (wnd->_cr)
#define WBORDER (wnd->wcolour[WIN_BORDER])
#define WTITLEC (wnd->wcolour[WIN_TITLE])
#define WFOOTC (wnd->wcolour[WIN_FOOT])
#define WACCENT (wnd->wcolour[WIN_ACCENT])
#define WFACE (wnd->wcolour[WIN_FACE])
#define WFIELD (wnd->wcolour[WIN_FLDFACE])
#define PWIN_FACE (wnd->_pn)
#define BTYPE (wnd->btype)
#define NEXT (wnd->_nx)
#define PREV (wnd->_pv)
#define WCOLOUR (wnd->wcolour)
#define VISIBLE (wnd->_wv)
#define HIDDEN (wnd->_hd)
#define FHEAD (wnd->_fh)
#define FTAIL (wnd->_ft)
#define BORDER_OFFSET (wnd->btype != BRD_NOBORDER) /* Added By Richard Deguara */
#define NW (wcs[wnd->btype].topleft)
#define NE (wcs[wnd->btype].topright)
#define SE (wcs[wnd->btype].botright)
#define SW (wcs[wnd->btype].botleft)
#define SIDE (wcs[wnd->btype].vert)
#define LINE (wcs[wnd->btype].hor)
/* ------------------------------------------------------------------------ */
/* window functions and macros */
/* ------------------------------------------------------------------------ */
void Wclear (WINDOW *);
void Wdeleteall (void);
void Wcursor (WINDOW *, int x, int y);
void Wdelete (WINDOW *);
void Wemsg (char *);
void Wemsgclear (void);
WINDOW *Westablish (int, int, int, int);
int Wgetsel (WINDOW *, int, char *);
void Whide (WINDOW *);
void Wprintf (WINDOW *, char *, ...);
void Wprompt (WINDOW *wnd, int, int, char *);
void Wputch (WINDOW *, int);
void Wputchat (WINDOW *wnd, int c, int bg, int fg, int i);
void Wsetborder (WINDOW *, int);
void Wsetcolour (WINDOW *, int, int, int, int);
void Wsetintensity (WINDOW *, int);
void Wsettitle (WINDOW *, char *, int);
void Wsetfooter (WINDOW *, char *, int);
void Wshow (WINDOW *);
#define Wforefront(wnd) wndrepos(wnd, 0, 0, 1)
#define Wmove(wnd,x,y) wndrepos(wnd, COL-x, ROW-y, 0)
#define Wrear(wnd) wndrepos(wnd, 0, 0, -1)
#define Wresetvideo(wnd) wnd->wcolour[WIN_FACE]=wnd->_pn
#define Wrevvideo(wnd) wnd->wcolour[WIN_FACE]=wnd->wcolour[WIN_ACCENT]
#define Wrmove(wnd,x,y) wndrepos(wnd, x, y, 0)
/* ------------------------------------------------------------------------ */
/* data entry functions */
/* ------------------------------------------------------------------------ */
void Fcleartemplate (WINDOW *wnd);
int Fdataentry (WINDOW *wnd, int p);
int Fdataview (WINDOW *wnd);
char *Finputline (char *p, char *bf, int x, int y, int l, int t);
void Ferrorfunc (FIELD *fld, void (*func)(char *));
void Fendfunc (int (*func) (int));
void Fhelpfunc (FIELD *fld, void (*func)(char *), int w);
FIELD *Festablish (WINDOW *wnd,int,int,char *,char *,int, int);
void Finittemplate (WINDOW *wnd);
void Fnulltemplate (WINDOW *wnd);
void Fsethelpwin (FIELD *fld, char *, int, int);
void Ftally (WINDOW *wnd);
void Fdeleteall (WINDOW *wnd);
void DeleteField (FIELD *fld);
#define Fprotect(f,s) f->fprot=s
#define Fpostvalidate(f,v) f->fvalid=v
#define Fprevalidate(f,v) f->fprevalid=v
/* ------------------------------------------------------------------------ */
/* keyboard functions */
/* ------------------------------------------------------------------------ */
unsigned int kgetch (void);
int kkeyhit (void);
int far *kstate (void);
/* ------------------------------------------------------------------------ */
/* internal to window processes */
/* ------------------------------------------------------------------------ */
void accent (WINDOW *);
void deaccent (WINDOW *);
void scroll (WINDOW *, int);
void wndrepos (WINDOW *, int, int, int);
void acline (WINDOW *, int);
void displ (WINDOW *wnd, int x, int y, int ch, int at);
#define accent(wnd) acline(wnd, WACCENT)
#define deaccent(wnd) acline(wnd, WFACE)